package com.xk.ucs.common;

/**
 * @ClassName ApplicationException
 * @Description 应用异常
 * @Author 01387843
 * @Date 2022/6/22
 **/
public class ApplicationException extends RuntimeException{
    protected String defaultErrorCode = "500";
    protected Object[] args;

    public ApplicationException(String code, String message) {
        super(message);
        this.defaultErrorCode = code;
    }
    public ApplicationException(ErrorEnum errorEnum) {
        super(errorEnum.getMessage());
        this.defaultErrorCode = errorEnum.getCode();
    }

    public ApplicationException(String code, String message, Throwable cause) {
        super(message, cause);
        this.defaultErrorCode = code;
    }


    public ApplicationException(String message) {
        super(message);
    }

    public ApplicationException(String message, Throwable cause) {
        super(message, cause);
    }

    public ApplicationException(String message, Object[] args) {
        super(message);
        this.args = args;
    }

    public ApplicationException(String message, Object[] args, Throwable cause) {
        super(message, cause);
        this.args = args;
    }

    public ApplicationException(String code, String message, Object[] args) {
        super(message);
        this.defaultErrorCode = code;
        this.args = args;
    }

    public ApplicationException(String code, String message, Object[] args, Throwable cause) {
        super(message, cause);
        this.defaultErrorCode = code;
        this.args = args;
    }

    public String getCode() {
        return this.defaultErrorCode;
    }

    public Object[] getArgs() {
        return this.args;
    }
}
